package com.ntv.domain;

import java.io.InputStream;
import java.util.Date;

import org.springframework.core.style.ToStringCreator;
import org.springframework.web.multipart.MultipartFile;

import com.ntv.persistent.util.DateHelper;

/**
 * @author Vedamoorthi Vairam
 * @since 05/01/2009
 *
 */
public class News implements INews {

	private Long id;
	
	private String publishDateString;

	private Date publishedOn = null;

	private Date createdOn;
	
	private Long createdBy;
	
	private String location;

	private String headLine;

	private String completeNews;

	private String category;
	
	private String categoryId;

	private Boolean hasContent;
	
	private Boolean isTopNews;
	
	private Integer position;
	
	private Long contentId;
	
	private Date updatedOn;
	private Long updatedBy;
	private InputStream image; 
	
	private String caption;
	
	
	private MultipartFile multipartFile;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getPublishedOn() {
		return publishedOn;
	}

	public void setPublishedOn(Date publishedOn) {
		this.publishedOn = publishedOn;
	}

	public Date getCreatedOn() {
		return createdOn;
	}

	public void setCreatedOn(Date createdOn) {
		this.createdOn = createdOn;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getHeadLine() {
		return headLine;
	}

	public void setHeadLine(String headLine) {
		this.headLine = headLine;
	}

	public String getCompleteNews() {
		return completeNews;
	}

	public void setCompleteNews(String completeNews) {
		this.completeNews = completeNews;
	}	
	
	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	@Override
	public String toString() {
		stringCreator.append("updatedOn ", updatedOn).append("publishedOn", publishedOn).append("createdOn", createdOn);
		return  stringCreator.toString();
	}

	/**
	 * @return the hasImage
	 */
	public Boolean getHasContent() {
		return hasContent;
	}

	/**
	 * @param hasImage the hasImage to set
	 */
	public void setHasContent(Boolean hasContent) {
		this.hasContent = hasContent;
	}

	/**
	 * @return the isTopNews
	 */
	public Boolean getIsTopNews() {
		return isTopNews;
	}

	/**
	 * @param isTopNews the isTopNews to set
	 */
	public void setIsTopNews(Boolean isTopNews) {
		this.isTopNews = isTopNews;
	}

	/**
	 * @return the position
	 */
	public Integer getPosition() {
		return position;
	}

	/**
	 * @param position the position to set
	 */
	public void setPosition(Integer position) {
		this.position = position;
	}

	/**
	 * @return the categoryId
	 */
	public String getCategoryId() {
		return categoryId;
	}

	/**
	 * @param categoryId the categoryId to set
	 */
	public void setCategoryId(String categoryId) {
		this.categoryId = categoryId;
	}

	/**
	 * @return the updateOn
	 */
	public Date getUpdatedOn() {
		return updatedOn;
	}

	/**
	 * @param updateOn the updateOn to set
	 */
	public void setUpdatedOn(Date updatedOn) {
		this.updatedOn = updatedOn;
	}
		
	
	ToStringCreator stringCreator = new  ToStringCreator(this);

	/**
	 * @return the contentId
	 */
	public Long getContentId() {
		return contentId;
	}

	/**
	 * @param contentId the contentId to set
	 */
	public void setContentId(Long contentId) {
		this.contentId = contentId;
	}

	/**
	 * @return the image
	 */
	public InputStream getImage() {
		return image;
	}

	/**
	 * @param image the image to set
	 */
	public void setImage(InputStream image) {
		this.image = image;
	}

	/**
	 * @return the caption
	 */
	public String getCaption() {
		return caption;
	}

	/**
	 * @param caption the caption to set
	 */
	public void setCaption(String caption) {
		this.caption = caption;
	}

	/**
	 * @return the multipartFile
	 */
	public MultipartFile getMultipartFile() {
		return multipartFile;
	}

	/**
	 * @param multipartFile the multipartFile to set
	 */
	public void setMultipartFile(MultipartFile multipartFile) {
		this.multipartFile = multipartFile;
	}

	/**
	 * @return the publishDateString
	 */
	public String getPublishDateString() {
		return publishDateString;
	}

	/**
	 * @param publishDateString the publishDateString to set
	 */
	public void setPublishDateString(String publishDateString){
		this.publishDateString = publishDateString;
		this.setPublishedOn(DateHelper.getParsedDate(publishDateString));
	}

	/**
	 * @return the createdBy
	 */
	public Long getCreatedBy() {
		return createdBy;
	}

	/**
	 * @param createdBy the createdBy to set
	 */
	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	/**
	 * @return the updatedBy
	 */
	public Long getUpdatedBy() {
		return updatedBy;
	}

	/**
	 * @param updatedBy the updatedBy to set
	 */
	public void setUpdatedBy(long updatedBy) {
		this.updatedBy = updatedBy;
	}
	
	
}